<!-- 客户等级 -->
<template>
    <div class="page-box h100 display-flex czbj">
        <p class="title-label mb10">客户等级</p>

        <div class="jjnmsertw">
            <n-dynamic-input v-model:value="customValue" :on-create="onCreate" show-sort-button>
                <template #create-button-default>
                    点击添加客户等级
                </template>
                <template #default="{ value }">
                    <div style="display: flex; align-items: center; width: 100%">
                        <n-input v-model:value="value.label" placeholder="label" size="medium" clearable></n-input>
                        <n-input v-model:value="value.value" placeholder="value" size="medium" clearable
                            class="ml20 sdfsdstrt"></n-input>
                    </div>
                </template>
            </n-dynamic-input>
            <p class="mt20">
                <n-button type="primary" size="medium" @click="handleValidateClick">保存</n-button>

            </p>
        </div>


    </div>
</template>
<script lang='ts' setup>
import { ref } from "vue"
import { dxget, dxpost, qurl, hf, transferTimeYMD, callBack } from "../../util/index";
const apiurl = "dxgjAdmin/dxDictionarymanagement"
const roid = localStorage.id
const customValue = ref([])
const djid = 18
const onCreate = () => {
    return {
        label: "",
        value: ""
    }
}
const initData = async () => {
    const { data }: any = await dxget(apiurl, { id: djid,roleId:roid })
    if (data.type == 5) {
        customValue.value = JSON.parse(data.text)
    }
}
initData()
const handleValidateClick = async (e) => {
    const { errno }: any = await dxpost(apiurl, {
        id:djid,
        text: JSON.stringify(customValue.value)
    }, 'put')
    if (errno == 0) {
        window.$message.success("操作成功！")
    }
}
</script>
<style scoped>
.jjnmsertw {
    width: 600px;
}
</style>